<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/3/22
 * Time: 9:57
 */
namespace app\admin\builder;
class BuliderConfig
{
    /**获取配置
     * @param $str
     * @return mixed|string
     */
    public static function get($str){
        $str = strToArray($str,'.');
        $config = [
          'zn_en'=>[
              '单行文本'=>'input',
              '多行文本'=>'textarea',
              '单文件'=>'file',
              '多文件'=>'files',
              '单图片'=>'img',
              '多图片'=>'imgs',
              '视频'=>'video',
              '单选框'=>'radio',
              '多选框'=>'checkbox',
              '下拉框'=>'select',
              '联动单选框'=>'radio',
              '联动多选框'=>'checkbox',
              '联动下拉框'=>'select',
              '联动下拉组'=>'optgroup',
              '编辑框'=>'editor',
              '编辑框(layui)'=>'editors',
              '开关'=>'switch',
              '时间'=>'time',
              'json数组'=>'json',
          ]
        ];
        $res = '';
        $o = 0;
        foreach ($str as $value){
            if($value){
                if($o ==0){
                    $res = $config[$value];
                }else{
                    $res = $res[$value];
                }
            }
        }
        return $res;
    }
}